<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Cache-control" content="no-cache">

	<%-- CSS Style Declarations --%>
	<link rel ="stylesheet" type="text/css" href="css/style.css" ></link>
	
		<%-- Java imports --%>
	<%@ page import="java.io.*" %>
	<%@ page import="java.util.*" %>
	<%@ page import="org.eclipse.wtp.sample.flashcards.FlashCardSet" %>
		<%@ page import="org.eclipse.wtp.sample.flashcards.FlashCard" %>
	
	<%-- Get reference to Java Objects --%>
	<% 	FlashCardSet localset = (FlashCardSet)request.getSession().getAttribute("flashcardset");%>

	<title>Edit</title>
</head>

<body>

<div id="center-wrapper">
<div id="center-column">

<!-- Header -->
<div id="header">
<FORM action="/FlashCards/ToMain" method="post">
			<input
				type="submit"
				name="button1"
				class="headerbutton"
				value="Main Menu"
				title="">
</FORM>
</div> <!-- header -->

	
	

<!-- Dictionary Title -->
<div style="
	position:absolute;
	top:8px;
	left:100px;
	color:#FFFFFF;
	font-weight:bold;
	">
	<% out.println( localset.getTitle()); %>
</div> <!-- dictionary title -->

<!-- Page Title -->
<div style="
	font-size:30px;
	width: 600px;
	text-align:center;
	position:absolute;
	top:50px;
	">
	Edit Dictionary
</div> <!-- page title -->

<!-- Message -->
<div style="
	position:absolute;
	top: 100px;
	width: 600px;
	text-align:center;
	">
	<% out.println(request.getSession().getAttribute("message")); %>
</div> <!-- message -->


<!-- Contents Selector -->
<div style="
	width: 600px;
	text-align:left;
	position:absolute;
	top:140px;
	left: 20px;
	">
<FORM action="/FlashCards/EditDictionary" method="post">
<select multiple size="13" name="Dictionary Contents" style="width:20em">
<% 	Iterator<FlashCard> itr = localset.iterator(); 
		while (itr.hasNext()) {
			FlashCard f = itr.next();
			String entry = f.getKey1() + "::" + f.getKey2();
			out.println("<option value=\"" + entry + "\">" + entry + "</option>" );
		}%>
	</select><br>
	<input type="submit" name="mode" value="Delete Entry">
	<input type="submit" name="mode" value="Order by Key 1">
	<input type="submit" name="mode" value="Order by Key 2">
	<input type="submit" name="mode" value="Delete Dictionary">
	
</FORM>

</div> <!-- contents selector -->

<!-- New Word Form -->
<form action="/FlashCards/EditDictionary" method="post">
<div style="
	position:absolute;
	top:140px;
	left:280px;
	width:300px;
	text-align:left;
	">
	<fieldset>
	<legend>New Word</legend>
	
	New Key 1 :
	<input type="text" class="text" size="20" maxlength="20" name="key1" /><br>
	New Key 2 :
	<input type="text" class="text" size="20" maxlength="20" name="key2" /><br>
	<input type="submit" name="mode" value="Add Word" />
	
	</fieldset>
</div>	
</form> <!-- new word form -->

</div> <!-- center-column -->
</div> <!-- center-wrapper -->
</body>
</html>